package com.homepage.domain;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * A PartnerLogo.
 */
@Entity
@Table(name = "partner_logo")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Getter
@Setter
@ToString
public class PartnerLogo implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Lob
    @Column(name = "logo", nullable = false)
    private byte[] logo;

    @NotNull
    @Column(name = "logo_content_type", nullable = false)
    private String logoContentType;

    @NotNull
    @Column(name = "partner_id", nullable = false)
    private Long partnerId;

    public PartnerLogo id(Long id) {
        this.setId(id);
        return this;
    }

    public PartnerLogo logo(byte[] logo) {
        this.setLogo(logo);
        return this;
    }

    public PartnerLogo logoContentType(String logoContentType) {
        this.logoContentType = logoContentType;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof PartnerLogo)) {
            return false;
        }
        return id != null && id.equals(((PartnerLogo) o).id);
    }

    @Override
    public int hashCode() {
        return getClass().hashCode();
    }
}
